//
//  AliMNSResponse.h
//  AlibabaCloudMNSiOS
//
//  Created by David Chen on 28/03/2017.
//  Copyright © 2017 AliCloud. All rights reserved.
//
#import "AliMNSHttp.h"
#import "AliMNSQueueMeta.h"
#import "AliMNSMessage.h"
#import "AliMNSSubscription.h"
#import "AliMNSTopicMeta.h"
#import "AliMNSTopicMessage.h"
#import "AliMNSError.h"

@interface AliMNSResponseBase : NSObject

@property NSError* internalError; // error from network.
@property NSMutableArray* header; // response http header.

// parse from mns response data.
@property NSString* code;
@property NSString* errorMessage;
@property NSString* requestId;
@property NSString* hostId;

-(void) parseFromInternalHttpResponse:(AliMNSHttpResponseInternal*) res;
-(void) parseErrorCode:(AliMNSHttpResponseInternal*) res;
-(void) checkError:(AliMNSHttpResponseInternal*) res;
-(AliMNSError*) generateError;
@end


/*
 Interfaces for queue opertions response classes: CreateQueue, DeleteQueue, ListQueue,
 SendMessage, BatchSendMessage, PeekMessage, BatchPeekMessage, ReceiveMessage,
 BatchReceiveMessage, ChangeMessageVisisbility.
 */
@interface AliMNSCreateQueueResponse : AliMNSResponseBase
@property NSString* queueUrl;
@end

@interface AliMNSDeleteQueueResponse : AliMNSResponseBase
@end

@interface AliMNSListQueueResponse : AliMNSResponseBase

//@property NSArray* queueUrlList;
@property NSString* nextMarker;
@property NSArray* queueMetaList;
@end

@interface AliMNSSetQueueAttributesResponse : AliMNSResponseBase
@end

@interface AliMNSGetQueueAttributesResponse : AliMNSResponseBase
{
}
@property AliMNSQueueMeta* queueMeta;
@end

@interface AliMNSSendMessageResponse : AliMNSResponseBase

@property AliMNSMessage* message;
@end

@interface AliMNSBatchSendMessageResponse : AliMNSResponseBase
{
}
@property NSArray* messageList;
@end

@interface AliMNSPeekMessageResponse : AliMNSResponseBase
@property AliMNSMessage* message;
@end

@interface AliMNSBatchPeekMessageResponse : AliMNSResponseBase
@property NSArray* messageList;
@end

@interface AliMNSReceiveMessageResponse : AliMNSResponseBase
@property AliMNSMessage* message;
@end

@interface AliMNSBatchReceiveMessageResponse : AliMNSResponseBase
@property NSArray* messageList;
@end

@interface AliMNSDeleteMessageResponse : AliMNSResponseBase
@end

@interface AliMNSBatchDeleteMessageResponse : AliMNSResponseBase
@end

@interface AliMNSChangeMessageVisibilityResponse : AliMNSResponseBase
@property NSString* receiptHandle;
@property NSInteger nextVisibleTime;
@end

/*
 Interfaces for topic opertions response classes:CreateTopic, DeleteTopic, ListTopic,
 SetTopicAttributes, GetTopicAttributes, PublishMessage, Subcribe, Unsubscribe,
 ListSubscription, SetSubscriptionAttributes; GetSubscriptionAttributes;
 */
@interface AliMNSCreateTopicResponse : AliMNSResponseBase
@property NSString* topicUrl;
@end

@interface AliMNSDeleteTopicResponse : AliMNSResponseBase
@end

@interface AliMNSListTopicResponse : AliMNSResponseBase
@property NSArray* topicList;
@property NSString* nextMarker;
@end

@interface AliMNSSetTopicAttributesResponse : AliMNSResponseBase
@end

@interface AliMNSGetTopicAttributesResponse : AliMNSResponseBase
@property AliMNSTopicMeta* topicMeta;
@end

@interface AliMNSPublishMessageResponse : AliMNSResponseBase
@property AliMNSTopicMessage* message;
@end

@interface AliMNSSubscribeResponse: AliMNSResponseBase
@property NSString* subscriptionUrl;
@end

@interface AliMNSUnsubcribeResponse : AliMNSResponseBase
@end

@interface AliMNSListSubscriptionResponse : AliMNSResponseBase
@property NSArray* subscriptionUrlList;
@property NSString* nextMarker;
@end

@interface AliMNSSetSubscriptionAttributesResponse : AliMNSResponseBase
@end

@interface AliMNSGetSubscriptionAttributesResponse : AliMNSResponseBase
@property AliMNSSubscription* subscriptionMeta;
@end
